package com.salton123.soulove.splash

import android.Manifest
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.launcher.ARouter
import com.qw.soul.permission.SoulPermission
import com.salton123.soulove.common.Constants

/**
 * User: newSalton@outlook.com
 * Date: 2019/8/6 17:46
 * ModifyTime: 17:46
 * Description:
 */
class SplashActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val isGranted = SoulPermission.getInstance().checkPermissions(
            Manifest.permission.WRITE_EXTERNAL_STORAGE,
            Manifest.permission.READ_EXTERNAL_STORAGE
        ).none { !it.isGranted }
        var path = Constants.Router.App.MAIN
        if (!isGranted) {
            path = Constants.Router.App.WELCOME
        }
        ARouter.getInstance()
            .build(path)
            .navigation(this@SplashActivity)
        finish()
    }

    override fun onBackPressed() {
    }
}
